import { defHttp } from '@/utils/http/axios';
import { RequestEnum } from '@/enums/httpEnum';
import { ServicePrefixEnum } from '@/enums/commonEnum';
import type { AxiosRequestConfig } from 'axios';

const MODULAR = '/system/social-user';

export const Api = {
  GetSocialUserPage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/page`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
  GetSocialUser: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/get`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
}


// 查询社交用户列表
export const getSocialUserPage = async (params) => {
  return await defHttp.request({ ...Api.GetSocialUserPage,params})
}

// 查询社交用户详情
export const getSocialUser = async (id: number) => {
  return await defHttp.request({ ...Api.GetSocialUser,params:{id}})
}

export interface SocialUserVO {
  id: number
  type: number
  openid: string
  token: string
  rawTokenInfo: string
  nickname: string
  avatar: string
  rawUserInfo: string
  code: string
  state: string
}

// // 查询社交用户列表
// export const getSocialUserPage = async (params) => {
//   return await request.get({ url: `/system/social-user/page`, params })
// }
//
// // 查询社交用户详情
// export const getSocialUser = async (id: number) => {
//   return await request.get({ url: `/system/social-user/get?id=` + id })
// }
